package com.yyfax.pay.config.model.to;

import org.apache.commons.lang3.StringUtils;

import com.yyfax.framework.exception.YYException;
import com.yyfax.framework.model.Params;
import com.yyfax.framework.yyfax.enums.RspCodeEnum;
import com.yyfax.pay.common.enums.PayRspCodeEnum;

/**
 * 商户支付限额信息参数
 * 
 * @author changxd
 * @date 2017-04-12
 * @since 1.0.0
 */
@SuppressWarnings("serial")
public class PaymentQuotaSaveParams extends Params {

	/** 模块Id参与签名 mid */
	private String mid;
	/** 商户编号 merchantCode */
	private String merchantCode;
	/** 支付通道编号 paymentCode */
	private String paymentCode;
	/** 银行编号 bankCode */
	private String bankCode;
	/** 单笔限额（分） singleQuota */
	private int singleQuota;
	/** 单日限额（分） dayQuota */
	private int dayQuota;
	/** 单月限额（分） monthQuota */
	private int monthQuota;
	/** 状态，0-停用，1-启用 state */
	private String state;
	/** 备注 remark */
	private String remark;
	/** 创建日期 create_time */
	private String createTime;

	@Override
	public boolean validate() throws Exception {
		if (StringUtils.isBlank(merchantCode)) {
			throw new YYException(RspCodeEnum.COMMON_ERROR_PARAMETER_INVALID, "参数 'merchantCode'不能为空");
		}
		if (StringUtils.isBlank(paymentCode)) {
			throw new YYException(RspCodeEnum.COMMON_ERROR_PARAMETER_INVALID, "参数 'paymentCode'不能为空");
		}
		if (StringUtils.isBlank(bankCode)) {
			throw new YYException(RspCodeEnum.COMMON_ERROR_PARAMETER_INVALID, "参数 'bankCode'不能为空");
		}
		if (singleQuota < 0) {
			throw new YYException(PayRspCodeEnum.PAY_CODE_SINGLEQUOTA_ERROR, "单笔限额（分）必须大于等于0");
		}
		if (dayQuota < 0) {
			throw new YYException(PayRspCodeEnum.PAY_CODE_DAYQUOTA_ERROR, "单日限额（分）必须大于等于0");
		}
		if (monthQuota < 0) {
			throw new YYException(PayRspCodeEnum.PAY_CODE_MONTHQUOTA_ERROR, "单日限额（分）必须大于等于0");
		}
		if (StringUtils.isBlank(state)) {
			throw new YYException(RspCodeEnum.COMMON_ERROR_PARAMETER_INVALID, "参数 'state'不能为空");
		}
		if (StringUtils.isBlank(remark)) {
			throw new YYException(RspCodeEnum.COMMON_ERROR_PARAMETER_INVALID, "参数 'remark'不能为空");
		}
		return true;
	}

	public String getMid() {
		return mid;
	}

	public void setMid(String mid) {
		this.mid = mid;
	}

	public String getMerchantCode() {
		return merchantCode;
	}

	public void setMerchantCode(String merchantCode) {
		this.merchantCode = merchantCode;
	}

	public String getPaymentCode() {
		return paymentCode;
	}

	public void setPaymentCode(String paymentCode) {
		this.paymentCode = paymentCode;
	}

	public String getBankCode() {
		return bankCode;
	}

	public void setBankCode(String bankCode) {
		this.bankCode = bankCode;
	}

	public int getSingleQuota() {
		return singleQuota;
	}

	public void setSingleQuota(int singleQuota) {
		this.singleQuota = singleQuota;
	}

	public int getMonthQuota() {
		return monthQuota;
	}

	public void setMonthQuota(int monthQuota) {
		this.monthQuota = monthQuota;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int getDayQuota() {
		return this.dayQuota;
	}

	public void setDayQuota(int dayQuota) {
		this.dayQuota = dayQuota;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

}
